﻿#define _CRT_SECURE_NO_WARNINGS
//作者：爱吃糖的boy
#include "game.h"
void menu();
void game();
int main() 
{
	srand((unsigned int)time(NULL));
	int a;
	do
	{
		menu();
		printf("请输入数字:\n");
		scanf("%d",&a);
		switch (a)
		{
		case 1:
			game();
			break;
		case 0:
			printf("游戏结束，离开\n");
			break;
		default:
			printf("输入错误，重新输入：\n");
			break;
		}
	} while (a);
	return 0;
}

void menu()
{
	printf("***********************\n");
	printf("*****   1.play   ******\n");
	printf("*****   0.exit   ******\n");
	printf("***********************\n");
}

void game() 
{

	char mine[ROWS][COLS];
	char show[ROWS][COLS];
	//初始化棋盘
	//1. mine数组最开始是全'0'
	//2. show数组最开始是全'*'
	InitBoard(mine,ROWS,COLS,'0');
	InitBoard(show,ROWS,COLS,'*');
	DisplayBoard(mine, ROW,COL);
	DisplayBoard(show, ROW, COL);
	SetMine(mine, ROW, COL);
	//DisplayBoard(mine, 11, 11);
	FindMine(mine, show, ROW, COL);
}